package com.wuchao.test;

import com.wuchao.entity.User;
import com.wuchao.mapper.StuinfoMapper;
import com.wuchao.mapper.UserMapper;
import com.wuchao.util.Util;
import org.apache.ibatis.session.SqlSession;
import org.junit.Test;
import org.omg.CORBA.PUBLIC_MEMBER;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Author wuchao66
 * @Date 2022/6/30 10:29
 * @Version 1.0
 */

public class Tjuit {//黑盒测试
    SqlSession sqlSession = Util.openSqlsession();
  @Test
   public void selectUserListByMap(){//测试map入参
        Map map=new HashMap<>();
        map.put("name1","超哥");
        map.put("sex1","好家伙");
      sqlSession.getMapper(UserMapper.class)
              .selectUserListByMap(map).forEach(System.out::println);
    }
    @Test
    public void selectUserListByArray(){//测试数组入参
        sqlSession.getMapper(UserMapper.class)
                .selectUserListByArray(new int[]{1,4,5,9,119}).forEach(System.out::println);
    }
    @Test
    public void selectUserListByList(){//测试list入参
        sqlSession.getMapper(UserMapper.class)
                .selectUserListByList(Arrays.asList(new String[]{"超","10","我大哥习近平"}))
                .forEach(System.out::println);
    }
    @Test
    public void selectUserListByMapListNames(){//测试maplist入参
        Map<String,List<String>> stringHashMap = new HashMap<>();
        stringHashMap.put("key",Arrays.asList(new String[]{"超","10","我大哥习近平","我工资3500"}));
        sqlSession.getMapper(UserMapper.class)
                .selectUserListByMapListNames(stringHashMap)
                .forEach(System.out::println);

    }
    @Test
    public void deleteByPrimaryKey(){
        sqlSession.getMapper(StuinfoMapper.class).deleteByPrimaryKey(5);
    }

}
